package org.vectrics.recruiter.job.event;

import java.util.Locale;

import org.vectrics.common.html.BorderTable;
import org.vectrics.mail.EmailTable;
import org.vectrics.provider.CoreServiceLocator;
import org.vectrics.recruiter.job.Job;

public class JobInfoEmailTable extends EmailTable {

	public JobInfoEmailTable(Locale locale, Job job) {
		super(locale);
		this.setWidth(600);
		
		this.addProperyRow( 
				this.getPhrase("prompt.job.reference.id"), 
				job.getReferenceId());
	
		this.addProperyRow( 
				this.getPhrase("prompt.job.title"), 
				job.getTitle());
		
		this.addProperyRow( 
				this.getPhrase("prompt.job.status"), 
				this.getPhrase(job.getCurrentStatus().getStatusType().getDescriptionCode())
				+ "<br><i>" + this.getPhrase(job.getCurrentStatus().getStatusReasonType().getName())
				+ "</i>");

		this.addProperyRow( 
				this.getPhrase("prompt.created.by"), 
				job.getCreatedBy().getName());

		this.addProperyRow( 
				this.getPhrase("prompt.last.updated.by"), 
				job.getLastModifiedBy().getName());

		this.addProperyRow( 
				this.getPhrase("prompt.last.updated.date"), 
				CoreServiceLocator.getDateFormat().getDateFormatRoundToMinute(this.getLocale()).format(job.getLastModifiedDate()));
	
		this.addProperyRow( 
				this.getPhrase("prompt.job.company"), 
				job.getCompany().getName());
		
		if (job.getPrimaryRecruiter() != null) {
			this.addProperyRow( 
					this.getPhrase("prompt.job.primary.recruiter"), 
					job.getPrimaryRecruiter().getName());
		}
		
		if (job.getSecondaryRecruiter() != null) {
			this.addProperyRow( 
					this.getPhrase("prompt.job.secondary.recruiter"), 
					job.getSecondaryRecruiter().getName());
		}
	
		this.addProperyRow( 
				this.getPhrase("prompt.job.hiring.manager"), 
				job.getHiringManager().getName());
		
		this.addProperyRow( 
				this.getPhrase("prompt.job.description"), 
				job.getDescription());
		
		this.addProperyRow( 
				this.getPhrase("prompt.job.location"), 
				job.getLocationDescription());
	}

}
